<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>OpenWrt Firmware Selector</title>
    <link rel="icon" href="favicon.ico" />
    <link rel="stylesheet" href="index.css" />
    <script src="config.js"></script>
    <script src="index.js"></script>
  </head>
  <body onload="init()">
    <!-- header across the whole page -->
    <header>
      <div>
        <a href="https://openwrt.org">
          <img src="logo.svg" width="180" alt="Logo" />
        </a>
        <div style="flex-grow: 1"></div>
        <div>
          <select id="languages-select">
            <option value="ar">العربية (Arabic)</option>
            <option value="ast">Asturianu (Asturian)</option>
            <option value="bg">български (Bulgarian)</option>
            <option value="bn">বাংলা (Bengali)</option>
            <option value="ca">Català (Catalan)</option>
            <option value="cs">Čeština (Czech)</option>
            <option value="da">Dansk (Danish)</option>
            <option value="de">Deutsch (German)</option>
            <option value="el">Ελληνικά (Greek)</option>
            <option value="en">English</option>
            <option value="es">Español (Spanish)</option>
            <option value="fa">فارسی (Persian)</option>
            <option value="fi">Suomalainen (Finnish)</option>
            <option value="fil">Pilipino (Filipino)</option>
            <option value="fr">Français (French)</option>
            <option value="ga">Gaeilge (Irish)</option>
            <option value="gl">Galego (Galician)</option>
            <option value="hu">Magyar (Hungarian)</option>
            <option value="id">Bahasa Indonesia (Indonesian)</option>
            <option value="it">Italiano (Italian)</option>
            <option value="ja">日本 (Japanese)</option>
            <option value="ka">ქართული (Georgian)</option>
            <option value="ko">한국어 (Korean)</option>
            <option value="lt">Lietuvių (Lithuanian)</option>
            <option value="lv">Latviešu (Latvian)</option>
            <option value="ml">മലയാളം (Malayalam)</option>
            <option value="no">Norsk (Norwegian)</option>
            <option value="pl">Polski (Polish)</option>
            <option value="pt">Português (Portuguese)</option>
            <option value="pt-br">
              Português do Brasil (Brazilian Portuguese)
            </option>
            <option value="ro">Română (Romanian)</option>
            <option value="ru">Русский (Russian)</option>
            <option value="sgs">Žemaitiu kalba (Samogitian)</option>
            <option value="sr">Српски (Serbian)</option>
            <option value="sk">Slovenčina (Slovak)</option>
            <option value="sv">Svenska (Swedish)</option>
            <option value="te">తెలుగు (Telugu)</option>
            <option value="tr">Türkçe (Turkish)</option>
            <option value="uk">Українська (Ukrainian)</option>
            <option value="vi">Tiếng Việt (Vietnamese)</option>
            <option value="zh-cn">简体中文 (Chinese Simplified)</option>
            <option value="zh-tw">繁體中文 (Chinese Traditional)</option>
          </select>
          <button id="languages-button"></button>
        </div>
      </div>
    </header>

    <div id="alert" class="hide"></div>

    <div class="container">
      <div>
        <h2 class="tr-load">Download OpenWrt Firmware for your Device</h2>
        <p class="tr-message">
          Type the name or model of your device, then select a stable build or
          the nightly "snapshot" build.
        </p>

        <!-- Model name and Build dropdown -->
        <div id="models-autocomplete" class="autocomplete">
          <input
            id="models"
            type="text"
            class="tr-model"
            placeholder="Model"
            spellcheck="false"
            autocapitalize="off"
            autofocus
          />
          <select id="versions" size="1"></select>
        </div>

        <div id="notfound" class="hide">
          <h3 class="tr-not-found">No model found!</h3>
        </div>

        <div id="images" class="hide">
          <!-- static information about the selected build -->
          <div>
            <h3 id="build-title" class="tr-version-build">About this build</h3>
            <div class="row">
              <div class="col1 tr-model">Model</div>
              <div class="col2" id="image-model"></div>
            </div>
            <div class="row">
              <div class="col1 tr-target">Target</div>
              <div class="col2" id="image-target"></div>
            </div>
            <div class="row">
              <div class="col1 tr-version">Version</div>
              <div class="col2">
                <span id="image-version"></span> (<span id="image-code"></span>)
              </div>
            </div>
            <div class="row">
              <div class="col1 tr-date">Date</div>
              <div class="col2" id="image-date"></div>
            </div>
            <div class="row">
              <div class="col1 tr-links">Links</div>
              <div class="col2">
                <a id="image-folder" href="#"></a>
                <a id="image-info" href="#"></a>
                <a id="image-link" href="#"></a>
              </div>
            </div>
            <div class="row">
              <details id="asu" class="hide" style="width: 100%">
                <summary>
                  <span class="tr-customize"
                    >Customize installed packages and/or first boot script</span
                  >
                </summary>
                <div id="asu-buildstatus" class="hide">
                  <span></span>
                  <div id="asu-log" class="hide">
                    <details>
                      <summary>
                        <code>STDERR</code>
                      </summary>
                      <pre id="asu-stderr"></pre>
                    </details>
                    <details>
                      <summary>
                        <code>STDOUT</code>
                      </summary>
                      <pre id="asu-stdout"></pre>
                    </details>
                  </div>
                </div>
                <div>
                  <h5>Repositories</h5>
                  <textarea
                    rows="10"
                    id="repositories"
                    autocomplete="off"
                    spellcheck="false"
                    autocapitalize="off"
                    style="width:-webkit-fill-available"
                  ></textarea>
                </div>
                <div>
                  <h5>Repositories Keys</h5>
                  <textarea
                    rows="10"
                    id="repositories-keys"
                    autocomplete="off"
                    spellcheck="false"
                    autocapitalize="off"
                    style="width:-webkit-fill-available"
                  ></textarea>
                </div>
                <div>
                  <h5>Default Packages</h5>
                  <textarea
                    rows="10"
                    id="default-packages"
                    autocomplete="off"
                    spellcheck="false"
                    autocapitalize="off"
                    disabled
                    style="width:-webkit-fill-available"
                  ></textarea>
                </div>
                <div>
                  <span>ROOTFS PARTSIZE: </span>
                  <input
                    id="rootfs-partsize"
                    type="number"
                    max="1024"
                  ></input>
                </div>
                <div>
                  <h5 class="tr-packages">Installed Packages</h5>
                  <textarea
                    rows="10"
                    id="asu-packages"
                    autocomplete="off"
                    spellcheck="false"
                    autocapitalize="off"
                  ></textarea>
                </div>
                <h5 class="tr-defaults">
                  Script to run on first boot (uci-defaults)
                </h5>
                <div id="uci-defaults-group">
                  <textarea
                    rows="10"
                    id="uci-defaults-content"
                    autocomplete="off"
                    spellcheck="false"
                    autocapitalize="off"
                  ></textarea>
                  <span
                    id="uci-defaults-template"
                    data-link="uci-defaults/setup.sh"
                  ></span>
                </div>
                <div id="request-build-link" class="hide">
                  <a href="javascript:buildAsuRequest()" class="custom-link">
                    <span></span
                    ><span class="tr-request-build">REQUEST BUILD</span>
                  </a>
                </div>
              </details>
            </div>
          </div>

          <div id="downloads1">
            <h3 class="tr-downloads">Download an image</h3>
            <!-- table of rows of download button and help text -->
            <table id="download-table1"></table>
          </div>

          <div id="downloads2" style="display: none">
            <h3 class="tr-downloads">Download an image</h3>
            <!-- list of downloads buttons, only one help text is displayed -->
            <div id="download-links2"></div>
            <div id="download-extras2"></div>
          </div>
        </div>

        <div id="footer">
          <span id="all-downloads"
            ><a 
              href="https://downloads.openwrt.org" class="tr-server-link"
              target="_blank"
              >All Downloads</a
            ></span
          >
          |
          <span
            ><a
              href="https://forum.openwrt.org/t/the-openwrt-firmware-selector/81721" class="tr-feedback-link"
              target="_blank"
              >Feedback</a
            ></span
          >
          |
          <span
            ><a 
              href="https://github.com/openwrt/firmware-selector-openwrt-org/"
              target="_blank"
              >OFS <span id="ofs-version">0.0.0</span></a
            ></span
          >
          |
          <span
            ><a 
              href="https://github.com/czy21/openwrt-plugin/"
              target="_blank"
              >Github</a
            ></span
          >
          |
          <span id="firmware-selector-official"
            ><a 
              href="https://firmware-selector.openwrt.org"
              target="_blank"
              >Official</a
            ></span
          >
        </div>
      </div>
    </div>
  </body>
</html>
